package com.mxnavi5.example.DataStream;

import org.apache.flink.streaming.api.functions.source.RichParallelSourceFunction;

public class UdfSourceTest extends RichParallelSourceFunction {

    boolean running = true;
    int i =0;

    @Override
    public void run(SourceContext sourceContext) throws Exception {
        while (running){
            sourceContext.collect(i++);
            Thread.sleep(1000);
            if(i==20){
                Thread.sleep(10000);
            }
        }
    }

    @Override
    public void cancel() {
        running = false;
    }
}
